package businesslogic.network;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import databaseservice.*;

public class RMIStubClient {
	//databaseservice
	
	public BookPOService bookPOService;
	public CategoryPOService categoryPOService;
	public MemberPOService memberPOService;
	public OrderItemPOService orderItemPOService;
	public OrderPOService orderPOService;
	public UserPOService userPOService;
	public PromotionPOService promotionPOService;
	
	public RMIStubClient(){
		try {
			// search port
			bookPOService = (BookPOService) Naming.lookup("rmi://localhost:3001/BookPO");
			categoryPOService = (CategoryPOService) Naming.lookup("rmi://localhost:3008/CategoryPO");
			memberPOService = (MemberPOService) Naming.lookup("rmi://localhost:3003/MemberPO");
			orderItemPOService = (OrderItemPOService) Naming.lookup("rmi://localhost:3004/OrderItemPO");
			orderPOService = (OrderPOService) Naming.lookup("rmi://localhost:3005/OrderPO");
			userPOService = (UserPOService) Naming.lookup("rmi://localhost:3006/UserPO");
			promotionPOService = (PromotionPOService) Naming.lookup("rmi://localhost:3007/PromotionPO");
			System.out.println("ok");
			
		} catch (MalformedURLException | RemoteException | NotBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
